#pragma once
#include "stdafx.h"
#include "FbxObject.h"
#include "kfbxio/kfbxio.h"

namespace Skill
{
	namespace FbxSDK
	{
		ref class FbxError;
		ref class FbxString;
		namespace IO
		{
			/** \brief Base class for FBX file import and export.
			* \nosubgrouping
			*/
			public ref class FbxIO : FbxObject
			{	
				REF_DECLARE(FbxEmitter,KFbxIO);
				FbxIO(KFbxIO* instance) : FbxObject(instance)
				{
					_Free = false;
				}
			protected: 
				virtual void CollectManagedMemory() override;
			public:
				/** Get the FBX version number for this version of the FBX SDK.
				* FBX version numbers start at 5.0.0.
				* \param pMajor        Version major number.
				* \param pMinor        Version minor number.
				* \param pRevision     Version revision number.
				*/
				static property Version^ CurrentVersion
				{
					Version^ get();
				}

				/** Initialize object.
				* \param pFileName     Name of file to access.
				* \return              \c true if successful, \c false otherwise.
				* \remarks             To identify the error, call KFbxIO::GetLastErrorID().
				*/
				virtual bool Initialize(String^ fileName);

//#ifdef KARCH_DEV_MACOSX_CFM
//				virtual bool Initialize(const FSSpec &pMacFileSpec);
//				virtual bool Initialize(const FSRef &pMacFileRef);
//				virtual bool Initialize(const CFURLRef &pMacURL);
//#endif

				/** Get the file name.
				* \return     Filename or an empty string if the filename has not been set.
				*/
				virtual property String^ FileName
				{
					String^ get();
				}

				/** Progress update function.
				* \param pTitle           Title of status box.
				* \param pMessage         Description of current file read/write step.
				* \param pDetail          Additional string appended to previous parameter.
				* \param pPercentDone     Finished percent of current file read/write.
				* \remarks                Overload this function to receive an update of current file read/write.
				*/
				//virtual void ProgressUpdate(String^ %title, String^ %message,String^ %detail, float percentDone);

				/**
				* \name Error Management
				*/
				//@{

				/** Retrieve error object.
				* \return     Reference to error object.
				*/
				REF_PROPERTY_GET_DECLARE(FbxError,KError);

				/** \enum EError Error identifiers.
				* - \e eFILE_CORRUPTED
				* - \e eFILE_VERSION_NOT_SUPPORTED_YET
				* - \e eFILE_VERSION_NOT_SUPPORTED_ANYMORE
				* - \e eFILE_NOT_OPENED
				* - \e eFILE_NOT_CREATED
				* - \e eOUT_OF_DISK_SPACE
				* - \e eUNINITIALIZED_FILENAME
				* - \e eUNIDENTIFIED_ERROR
				* - \e eINDEX_OUT_OF_RANGE
				* - \e ePASSWORD_ERROR
				* - \e eSTREAM_OPTIONS_NOT_SET
				* - \e eEMBEDDED_OUT_OF_SPACE
				*/
				enum class Error
				{
					FileCorrupted = KFbxIO::eFILE_CORRUPTED,
					FileVersionNotSupportedYet= KFbxIO::eFILE_VERSION_NOT_SUPPORTED_YET,
					FileVersionNotSupportedAnymore= KFbxIO::eFILE_VERSION_NOT_SUPPORTED_ANYMORE,
					FileNotOpened = KFbxIO::eFILE_NOT_OPENED,
					FileNotCreated= KFbxIO::eFILE_NOT_CREATED,
					OutOfDiskSpace= KFbxIO::eOUT_OF_DISK_SPACE,
					UninitializedFilename= KFbxIO::eUNINITIALIZED_FILENAME,
					UnidentifiedError= KFbxIO::eUNIDENTIFIED_ERROR,
					IndexOutOfRange= KFbxIO::eINDEX_OUT_OF_RANGE,
					PasswordError= KFbxIO::ePASSWORD_ERROR,
					StreamOptionsNotSet= KFbxIO::eSTREAM_OPTIONS_NOT_SET,
					EmbeddedOutOfSpace= KFbxIO::eEMBEDDED_OUT_OF_SPACE,
					ErrorCount = KFbxIO::eERROR_COUNT
				};

				/** Get last error code.
				* \return     Last error code.
				*/
				property Error LastErrorID
				{
					Error get();
				}

				/** Get last error string.
				* \return     Textual description of the last error.
				*/
				property String^ LastErrorString
				{
					String^ get();
				}

				/** Get warning message from file reader/writer.
				* \param pMessage     Warning message
				*/
				void GetMessage(FbxString^ message);

			};

		}
	}
}